#!/bin/bash

#本脚本用于32位armbian系统安装宝塔面板,宝塔面板版本为7.5.1
#已经在玩客云的armbain5.88上测试成功,其他设备未测试,谨慎使用!

#脚本包含三部分
# 1) 更新国内软件源,使用中科大的源
# 2) 安装python-setuptools
# 3) 安装宝塔面板,来自宝塔官方修改，注释掉不支持32位系统代码


#更新国内源
cd /etc/apt/
mv sources.list sources.list.bak
wget https://gitee.com/ryuukarin/shell_scripts/raw/master/sources.list
chmod 755 sources.list
echo "sources.list Updating ..."
apt update


#安装python-setuptools
apt install python-setuptools


#安装libiconv库
# echo "Ready to install libiconv dependency package..."
# mkdir /root/software && cd /root/software
# wget http://mirrors.nju.edu.cn/gnu/libiconv/libiconv-1.16.tar.gz
# if [ -f libiconv-1.16.tar.gz ];then
#     tar zxvf libiconv-1.16.tar.gz
#     cd /root/software/libiconv-1.16
#     ./configure --prefix=/usr/local
#     if [ $? -eq 0 ];then
#         make && make install
#         if [ $? -eq 0 ];then
#             echo "libiconv dependency package Installation successful"
#         else
#             echo "libiconv dependency package Installation failed";exit 1
#         fi
#     else
#         echo "Libiconv dependency package configuration failed";exit 1
#     fi
# else
#     echo "Libiconv dependency package download failed";exit 1
# fi
# ln -s /usr/local/lib/libiconv.so /usr/lib
# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
# cd /root
# rm -rf /root/software/


#下载宝塔安装脚本并执行(宝塔版本7.5.1)
mkdir /root/bt && cd /root/bt/
echo "Preparing to install the BT panel..."
wget -O install.sh https://gitee.com/ryuukarin/shell_scripts/raw/master/shell/install_32_bt.sh && bash install.sh
